<!doctype html><html lang="en">
 <head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <title>CSS Line Grid Module Level 1</title>
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <meta content="exploring" name="csswg-work-status">
  <meta content="ED" name="w3c-status">
  <meta content="This module contains CSS features for aligning content to a baseline grid." name="abstract">
  <link href="../default.css" rel="stylesheet" type="text/css">
  <link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
  body {
    background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat;
  }
  </style>
  <link href="https://www.w3.org/TR/css-line-grid-1/" rel="canonical">
<style type="text/css">
	.sidenote-block {
		border: 1px solid gray;
		margin: auto;
		text-align: left;
		padding: 4pt;
		position: relative;
		max-width: 400pt;
	}
	.sidenote-body {
		margin-left: 120pt;
		font-size: 12pt;
		line-height: 18pt;
	}
	.sidenote-note {
		font-size: 10pt;
		line-height: 18pt;
		position: absolute; left: 4pt; top: 4pt;
		width: 110pt;
	}
</style>
<style>/* style-md-lists */

/* This is a weird hack for me not yet following the commonmark spec
   regarding paragraph and lists. */
[data-md] > :first-child {
    margin-top: 0;
}
[data-md] > :last-child {
    margin-bottom: 0;
}</style>
<style>/* style-counters */

body {
    counter-reset: example figure issue;
}
.issue {
    counter-increment: issue;
}
.issue:not(.no-marker)::before {
    content: "Issue " counter(issue);
}

.example {
    counter-increment: example;
}
.example:not(.no-marker)::before {
    content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
    content: "Invalid Example" counter(example);
}

figcaption {
    counter-increment: figure;
}
figcaption:not(.no-marker)::before {
    content: "Figure " counter(figure) " ";
}</style>
<style>/* style-dfn-panel */

.dfn-panel {
    position: absolute;
    z-index: 35;
    height: auto;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 300px;
    max-height: 500px;
    overflow: auto;
    padding: 0.5em 0.75em;
    font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
    background: #DDDDDD;
    color: black;
    border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
    display: inline-block;
    position: fixed;
    left: .5em;
    bottom: 2em;
    margin: 0 auto;
    max-width: calc(100vw - 1.5em - .4em - .5em);
    max-height: 30vh;
}

.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-selflinks */

.heading, .issue, .note, .example, li, dt {
    position: relative;
}
a.self-link {
    position: absolute;
    top: 0;
    left: calc(-1 * (3.5rem - 26px));
    width: calc(3.5rem - 26px);
    height: 2em;
    text-align: center;
    border: none;
    transition: opacity .2s;
    opacity: .5;
}
a.self-link:hover {
    opacity: 1;
}
.heading > a.self-link {
    font-size: 83%;
}
li > a.self-link {
    left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
    top: auto;
    left: auto;
    opacity: 0;
    width: 1.5em;
    height: 1.5em;
    background: gray;
    color: white;
    font-style: normal;
    transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
    opacity: 1;
}
dfn > a.self-link:hover {
    color: black;
}

a.self-link::before            { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before      { content: "#"; }</style>
<style>/* style-autolinks */

.css.css, .property.property, .descriptor.descriptor {
    color: #005a9c;
    font-size: inherit;
    font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
    content: "‘";
}
.css::after, .property::after, .descriptor::after {
    content: "’";
}
.property, .descriptor {
    /* Don't wrap property and descriptor names */
    white-space: nowrap;
}
.type { /* CSS value <type> */
    font-style: italic;
}
pre .property::before, pre .property::after {
    content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
    content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
    content: "’";
}

[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
    content: "";
}

[data-link-type=element],
[data-link-type=element-attr] {
    font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
    font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after  { content: ">" }

[data-link-type=biblio] {
    white-space: pre;
}</style>
 <body class="h-entry">
  <div class="head">
   <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
   <h1 class="p-name no-ref" id="title">CSS Line Grid Module Level 1</h1>
   <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
   <details>
    <summary>Specification Metadata</summary>
    <div data-fill-with="spec-metadata">
     <dl>
      <dt>This version:
      <dd><a class="u-url" href="https://drafts.csswg.org/css-line-grid/">https://drafts.csswg.org/css-line-grid/</a>
      <dt>Latest published version:
      <dd><a href="https://www.w3.org/TR/css-line-grid-1/">https://www.w3.org/TR/css-line-grid-1/</a>
      <dt>Previous Versions:
      <dd><a href="https://www.w3.org/TR/2014/WD-css-line-grid-1-20140916/" rel="prev">https://www.w3.org/TR/2014/WD-css-line-grid-1-20140916/</a>
      <dt class="editor">Editors:
      <dd class="editor p-author h-card vcard" data-editor-id="35400"><a class="p-name fn u-url url" href="http://fantasai.inkedblade.net/contact">Elika Etemad</a> (<span class="p-org org">Invited Expert</span>)
      <dd class="editor p-author h-card vcard" data-editor-id="45369"><a class="p-name fn u-email email" href="mailto:kojiishi@gluesoft.co.jp">Koji Ishii</a> (<span class="p-org org">Invited Expert</span>)
      <dd class="editor p-author h-card vcard" data-editor-id="46659"><a class="p-name fn u-email email" href="mailto:stearns@adobe.com">Alan Stearns</a> (<span class="p-org org">Adobe Systems, Inc.</span>)
      <dt>Suggest an Edit for this Spec:
      <dd><a href="https://github.com/w3c/csswg-drafts/blob/master/css-line-grid-1/Overview.bs">GitHub Editor</a>
      <dt>Issue Tracking:
      <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-line-grid-1">GitHub Issues</a>
     </dl>
    </div>
   </details>
   <div data-fill-with="warning"></div>
   <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 1970 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="https://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">permissive document license</a> rules apply. </p>
   <hr title="Separator for header">
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>This module contains CSS features for aligning content to a baseline grid.</p>
    <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, etc. 
  </div>
  <h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
  <div data-fill-with="status">
   <p> This is a public copy of the editors’ draft.
	It is provided for discussion only and may change at any moment.
	Its publication here does not imply endorsement of its contents by W3C.
	Don’t cite this document other than as work in progress. </p>
   <p> <a href="https://github.com/w3c/csswg-drafts/issues">GitHub Issues</a> are preferred for discussion of this specification.
	When filing an issue, please put the text “css-line-grid” in the title,
	preferably like this:
	“[css-line-grid] <i data-lt>…summary of comment…</i>”.
	All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>,
	and there is also a <a href="https://lists.w3.org/Archives/Public/www-style/">historical archive</a>. </p>
   <p> This document was produced by the <a href="https://www.w3.org/Style/CSS/">CSS Working Group</a>. </p>
   <p> This document was produced by a group operating under
	the <a href="https://www.w3.org/Consortium/Patent-Policy/">W3C Patent Policy</a>.
	W3C maintains a <a href="https://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group;
	that page also includes instructions for disclosing a patent.
	An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
   <p> This document is governed by the <a href="https://www.w3.org/2019/Process-20190301/" id="w3c_process_revision">1 March 2019 W3C Process Document</a>. </p>
   <p></p>
  </div>
  <div data-fill-with="at-risk"></div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li>
     <a href="#intro"><span class="secno">1</span> <span class="content"> Introduction</span></a>
     <ol class="toc">
      <li><a href="#context"><span class="secno">1.1</span> <span class="content"> Background</span></a>
      <li><a href="#placement"><span class="secno">1.2</span> <span class="content"> Module Interactions</span></a>
      <li><a href="#values"><span class="secno">1.3</span> <span class="content"> Values</span></a>
     </ol>
    <li><a href="#line-grid-property"><span class="secno">2</span> <span class="content"> Defining a <span>Line Grid</span>: the <span class="property">line-grid</span> property</span></a>
    <li>
     <a href="#grid-snapping"><span class="secno">3</span> <span class="content"> Snapping to a Grid</span></a>
     <ol class="toc">
      <li><a href="#line-snap"><span class="secno">3.1</span> <span class="content"> Snapping Line Boxes: the <span class="property">line-snap</span> property</span></a>
      <li><a href="#box-snap"><span class="secno">3.2</span> <span class="content"> Snapping Block Boxes: the <span class="property">box-snap</span> property</span></a>
     </ol>
    <li>
     <a href="#snap-details"><span class="secno">4</span> <span class="content"> Snapping Details</span></a>
     <ol class="toc">
      <li><a href="#alignment-interactions"><span class="secno">4.1</span> <span class="content"> Interacting with other alignments</span></a>
      <li><a href="#leading-adjustments"><span class="secno">4.2</span> <span class="content"> Leading adjustments</span></a>
     </ol>
    <li><a href="#acknowledgments"><span class="secno"></span> <span class="content">Acknowledgments</span></a>
    <li>
     <a href="#change-log"><span class="secno"></span> <span class="content"> Change Log</span></a>
     <ol class="toc">
      <li><a href="#20140916"><span class="secno"></span> <span class="content"> Since <span>September 16th 2014</span></span></a>
      <li><a href="#20140403"><span class="secno"></span> <span class="content"> Since <span>April 3rd 2014</span></span></a>
     </ol>
    <li>
     <a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
     <ol class="toc">
      <li><a href="#document-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a>
      <li><a href="#conform-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a>
      <li>
       <a href="#conform-responsible"><span class="secno"></span> <span class="content"> Requirements for Responsible Implementation of CSS</span></a>
       <ol class="toc">
        <li><a href="#conform-partial"><span class="secno"></span> <span class="content"> Partial Implementations</span></a>
        <li><a href="#conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a>
        <li><a href="#conform-testing"><span class="secno"></span> <span class="content"> Implementations of CR-level Features</span></a>
       </ol>
     </ol>
    <li>
     <a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
     <ol class="toc">
      <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
      <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
     </ol>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
      <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
     </ol>
    <li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a>
    <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
   </ol>
  </nav>
  <main>
   <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content"> Introduction</span><a class="self-link" href="#intro"></a></h2>
   <h3 class="heading settled" data-level="1.1" id="context"><span class="secno">1.1. </span><span class="content"> Background</span><a class="self-link" href="#context"></a></h3>
   <p><em>This section is not normative.</em></p>
   <p>This specification provides features
	to align lines and blocks
	to invisible grids in the document.</p>
   <p>Aligning lines and blocks to grids
	provides the following benefits:</p>
   <ul>
    <li>Vertical rhythm is kept for better readability.
    <li>Lines are aligned between columns in multi-column documents.
    <li>The top and the bottom margins of pictures are made equal,
			while keeping the vertical rhythm of text before and after the pictures.
    <li>Layout lines are at the same position on every page in paged media.
			Keeping the position of the bottom line of a page has benefits for
			design and readability.
			This also improves the readability of duplex printing,
			two pages spreads,
			and displaying on slow display devices like e-ink.
    <li>East Asian layouts require vertical rhythm
			more often than other scripts do,
			even in single column, non-paged media documents,
			as defined in <a data-link-type="biblio" href="#biblio-jlreq">[JLREQ]</a>.
   </ul>
   <p>There are several types of objects in a document
	that can break the vertical rhythm.
	Examples include lines with different sizes of text,
	pictures, and tables.</p>
   <div class="figure">
     <img alt="Vertical rhythm kept through pictures and different size of text in a multi-column document" src="images/line-grid-multicol.png" width="480"> 
    <p class="caption">Vertical rhythm kept through pictures and different size of text in a multi-column document.</p>
   </div>
   <div class="example" id="example-1b67eeaa">
    <a class="self-link" href="#example-1b67eeaa"></a> 
    <div class="sidefigure">
      <img alt="Large text wraps within line grids" src="images/line-grid-wrap.png" width="276"> 
     <p class="caption">Large text wraps within line grids.</p>
    </div>
    <p>When a different size of text,
		such as a headings wraps,
		it is usually aligned to grids as a block
		and the lines within the block do not align.</p>
    <p><br style="clear:both;"></p>
   </div>
   <div class="figure" id="ex-sidenote">
    <div class="sidenote-block">
     <div class="sidenote-body">
      <p>Sidenotes (and footnotes for that matter) are often set
				at a smaller size than the basic text.
				This smaller text should still line up with the basic text.
				Authors can try to achieve this effect
				by calculating appropriate font-size, line-height,
				and margins*, but lack the proper tools to get the baselines to align.</p>
     </div>
     <div class="sidenote-note">
      <p>Even if the author controls all this,
				the baselines won’t align. And careful
				calculations can be thrown off by user stylesheets.</p>
     </div>
    </div>
    <p class="caption">Sidenotes are set at a smaller size, and baselines don’t align.</p>
   </div>
   <figure>
     <img alt="sidenote rendering with aligned baselines" src="images/sidenote-aligned.png"> 
    <figcaption> Sidenote with baselines aligned to the body text. </figcaption>
   </figure>
   <div class="sidefigure" id="ex-width">
     <img alt="East Asian layouts may require width be a multiple of em without fractions" height="142" src="width-multiple-of-em.png" width="180"> 
    <p class="caption">East Asian layouts may require width
			be a multiple of <em>em</em> without fractions.</p>
   </div>
   <p>East Asian layouts may require grid-like features
	in inline progression direction as well.</p>
   <p>It is often desirable in East Asian layouts
	to make the line width
	a multiple of <em>em</em> without fractions.
	Because most East Asian characters have 1em advance
	and most East Asian documents are justified,
	this minimizes cases where justification needs to expand character spacing.</p>
   <p>This module provides the following capabilities:</p>
   <ul>
    <li>Defining grids in the line progression direction.
    <li>Controlling how lines and blocks align to the grids.
   </ul>
   <p>It is important to control these capabilities independently,
	so that, for example,
	aligning to grids can be turned off for tables,
	but can then be turned back on
	for aligning the following text to the grids.</p>
   <h3 class="heading settled" data-level="1.2" id="placement"><span class="secno">1.2. </span><span class="content"> Module Interactions</span><a class="self-link" href="#placement"></a></h3>
   <p>This module extends the line box model
	defined in <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a> sections 9.4.2 and 10.8.</p>
   <h3 class="heading settled" data-level="1.3" id="values"><span class="secno">1.3. </span><span class="content"> Values</span><a class="self-link" href="#values"></a></h3>
   <p>This specification follows the <a href="https://www.w3.org/TR/CSS21/about.html#property-defs">CSS property definition conventions</a> from <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>.
	Value types not defined in this specification are defined in CSS Values &amp; Units <a data-link-type="biblio" href="#biblio-css-values-3">[CSS-VALUES-3]</a>.
	Other CSS modules may expand the definitions of these value types.</p>
   <p>In addition to the property-specific values listed in their definitions,
	all properties defined in this specification
	also accept the <a data-link-type="dfn" href="https://drafts.csswg.org/css-values-4/#css-wide-keywords" id="ref-for-css-wide-keywords">CSS-wide keywords</a> keywords as their property value.
	For readability they have not been repeated explicitly.</p>
   <h2 class="heading settled" data-level="2" id="line-grid-property"><span class="secno">2. </span><span class="content"> Defining a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="line-grid">Line Grid</dfn>: the <a class="property" data-link-type="propdesc" href="#propdef-line-grid" id="ref-for-propdef-line-grid">line-grid</a> property</span><a class="self-link" href="#line-grid-property"></a></h2>
   <table class="def propdef" data-link-for-hint="line-grid">
    <tbody>
     <tr>
      <th>Name:
      <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-line-grid">line-grid</dfn>
     <tr class="value">
      <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
      <td class="prod">match-parent <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one">|</a> create 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
      <td>match-parent 
     <tr>
      <th>Applies to:
      <td>block, flex and grid containers 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
      <td>no 
     <tr>
      <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
      <td>N/A 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
      <td>specified keyword 
     <tr>
      <th>Canonical order:
      <td>per grammar 
     <tr>
      <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
      <td>discrete 
   </table>
   <p>Specifies whether this box creates
	a new baseline grid for its descendants
	or uses the same baseline grid as its parent.
	(Each box always has an associated <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid">line grid</a>.
	However, whether a box or its contents snap
	to a <span id="ref-for-line-grid①">line grid</span> is determined
	by <a class="property" data-link-type="propdesc" href="#propdef-line-snap" id="ref-for-propdef-line-snap">line-snap</a> and <a class="property" data-link-type="propdesc" href="#propdef-box-snap" id="ref-for-propdef-box-snap">box-snap</a>.)</p>
   <p>The values of this property have the following meanings:</p>
   <dl>
    <dt><dfn class="dfn-paneled css" data-dfn-for="line-grid" data-dfn-type="value" data-export id="valdef-line-grid-match-parent">match-parent</dfn> 
    <dd>Box assumes the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②">line grid</a> of its parent
			if its <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-4/#writing-mode" id="ref-for-writing-mode">writing mode</a> is the same as its parent.
			If the box has a <span id="ref-for-writing-mode①">writing mode</span> that is different than its parent,
			then the box creates a new <span id="ref-for-line-grid③">line grid</span> as <a class="css" data-link-type="maybe" href="#valdef-line-grid-create" id="ref-for-valdef-line-grid-create">create</a> below. 
    <dt><dfn class="dfn-paneled css" data-dfn-for="line-grid" data-dfn-type="value" data-export id="valdef-line-grid-create">create</dfn> 
    <dd>Box creates a new <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid④">line grid</a> using its own font and line layout settings,
			including any adjustment to the line height caused by the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-rhythm-1/#propdef-line-height-step" id="ref-for-propdef-line-height-step">line-height-step</a> property.
			The <span id="ref-for-line-grid⑤">line grid</span> consists of a series
			of horizontal lines corresponding
			to all the baselines
			(alphabetic, text-top, text-bottom,
			mathematic, central, hanging, etc.)
			and to the line-over and line-under edges,
			positioned where they would fall
			if the contents of this element consisted entirely
			of line boxes filled with text (no sub-elements)
			using the first available font.
			If the box is paginated,
			the <span id="ref-for-line-grid⑥">line grid</span> is restarted on each page;
			since line boxes cannot be fragmented,
			no page begins with the bottom part of a line’s grid. 
   </dl>
   <p>The initial containing block establishes a <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid⑦">line grid</a> using the font and line layout settings of the root element.
	If the root element (which has no parent)
	has a value of <a class="css" data-link-type="maybe" href="#valdef-line-grid-match-parent" id="ref-for-valdef-line-grid-match-parent">match-parent</a>,
	then it adopts the <span id="ref-for-line-grid⑧">line grid</span> of the initial containing block.</p>
   <p>In paged media,
	if the page context applying to a particular page
	specifies <a class="css" data-link-type="propdesc" href="#propdef-line-grid" id="ref-for-propdef-line-grid①">line-grid: create</a>,
	then a <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid⑨">line grid</a> for that page is established
	using the page context’s font and line layout settings
	applied to the page box (including its margins),
	and for layout within that page the initial containing block
	is assumed to have adopted this <span id="ref-for-line-grid①⓪">line grid</span>.</p>
   <div class="example" id="example-5340861c">
    <a class="self-link" href="#example-5340861c"></a> Since the initial value of <a class="property" data-link-type="propdesc" href="#propdef-line-grid" id="ref-for-propdef-line-grid②">line-grid</a> is <a class="css" data-link-type="maybe" href="#valdef-line-grid-match-parent" id="ref-for-valdef-line-grid-match-parent①">match-parent</a>,
		by default a <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid①①">line grid</a> is automatically created
		using the root element’s font and line height settings
		to fill the initial containing block / page area.
		When all pages of a document are the same size,
		this will result in a consistent <span id="ref-for-line-grid①②">line grid</span> that exactly aligns
		to the top of each page area. 
    <p>It is sometimes appropriate
		for the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid①③">line grid</a> to begin with the content,
		after the root element’s margins/padding/border
		and/or other header content.
		To do this, the root element (or some other element) can be told to establish the <span id="ref-for-line-grid①④">line grid</span>.</p>
<pre>main { line-grid: create; }
</pre>
    <p>If this <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid①⑤">line grid</a> is then paginated, the <span id="ref-for-line-grid①⑥">line grid</span> will start at the top of each page area after the first.</p>
    <p>In other cases, it’s desirable for
		all pages of a document share a common <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid①⑦">line grid</a>,
		even if page margins, border and/or padding change.
		The following rule will instead fill the page box area <em>including</em> the page margin/padding/borders
		with the <span id="ref-for-line-grid①⑧">line grid</span>:</p>
<pre>@page { line-grid: create; }
</pre>
    <p>As this <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid①⑨">line grid</a> is paginated, it will start at the top of each page box after the first;
		however it might not align to the top of the page area
		(where the content would normally begin).</p>
   </div>
   <p class="issue" id="issue-aa203f7b"><a class="self-link" href="#issue-aa203f7b"></a> The names of these values is currently up for debate.
	Current suggestions for match-parent
	include match-parent and normal;
	those for create include create and new.</p>
   <p class="note" role="note">The original proposal for line grids
	allowed an element to create a named grid.
	This property could still be extended to do this in the future. </p>
   <p class="note" role="note">There might need to be an offset
	for more complicated designs.
	How to set this offset is problematic:
	usually it’s not a fixed length,
	but the distance to clear some header content.
	This could be added to a later level of css-line-grid. </p>
   <h2 class="heading settled" data-level="3" id="grid-snapping"><span class="secno">3. </span><span class="content"> Snapping to a Grid</span><a class="self-link" href="#grid-snapping"></a></h2>
   <p>The <a class="property" data-link-type="propdesc" href="#propdef-line-snap" id="ref-for-propdef-line-snap①">line-snap</a> and <a class="property" data-link-type="propdesc" href="#propdef-box-snap" id="ref-for-propdef-box-snap①">box-snap</a> properties
	cause line boxes and block boxes to shift position
	in order to align to the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②⓪">line grid</a>.
	Shifting boxes in this way affects layout –
	it is not merely a display translation.
	If a line box is shifted,
	then subsequent line boxes will be laid out
	using the new shifted position as input
	to their line stacking rules.
	If a block box is shifted,
	then subsequent boxes will be laid out
	using the new shifted position as input.</p>
   <h3 class="heading settled" data-level="3.1" id="line-snap"><span class="secno">3.1. </span><span class="content"> Snapping Line Boxes: the <a class="property" data-link-type="propdesc" href="#propdef-line-snap" id="ref-for-propdef-line-snap②">line-snap</a> property</span><a class="self-link" href="#line-snap"></a></h3>
   <table class="def propdef" data-link-for-hint="line-snap">
    <tbody>
     <tr>
      <th>Name:
      <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-line-snap">line-snap</dfn>
     <tr class="value">
      <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
      <td class="prod">none <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①">|</a> baseline <span id="ref-for-comb-one②">|</span> contain 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
      <td>none 
     <tr>
      <th>Applies to:
      <td><a data-link-type="dfn" href="https://drafts.csswg.org/css-display-3/#block-container" id="ref-for-block-container">block container</a> elements 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
      <td>yes 
     <tr>
      <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
      <td>N/A 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
      <td>specified keyword 
     <tr>
      <th>Canonical order:
      <td>per grammar 
     <tr>
      <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
      <td>discrete 
   </table>
   <p>This property applies to all the line boxes
	directly contained by the element,
	and, when not none,
	causes each line box to shift
	(usually downward, possibly by zero)
	until it snaps to the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②①">line grid</a> specified by <a class="property" data-link-type="propdesc" href="#propdef-line-grid" id="ref-for-propdef-line-grid③">line-grid</a>.
	(The unshifted position is the position that
	would be determined by normal line stacking rules,
	with consideration of any new controls
	defined by other modules such as <a data-link-type="biblio" href="#biblio-css3line">[CSS3LINE]</a>.)</p>
   <p>Values have the following meanings:</p>
   <dl>
    <dt><dfn class="css" data-dfn-for="line-snap" data-dfn-type="value" data-export id="valdef-line-snap-none">none<a class="self-link" href="#valdef-line-snap-none"></a></dfn> 
    <dd>Line boxes do not snap to the grid; they stack normally. 
    <dt><dfn class="css" data-dfn-for="line-snap" data-dfn-type="value" data-export id="valdef-line-snap-baseline">baseline<a class="self-link" href="#valdef-line-snap-baseline"></a></dfn> 
    <dd>The dominant baseline snaps with the matching baseline on the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②②">line grid</a> applying to the element. 
    <dt><dfn class="css" data-dfn-for="line-snap" data-dfn-type="value" data-export id="valdef-line-snap-contain">contain<a class="self-link" href="#valdef-line-snap-contain"></a></dfn> 
    <dd> Two baselines are used to align the line box:
			the line box is snapped
			so that its <a href="https://drafts.csswg.org/css-inline/#central">central</a> baseline
			is centered between one
			of the line grid’s <a href="https://drafts.csswg.org/css-inline/#text-over-edge">text-over-edge</a> baselines
			and a subsequent (but not necessarily consecutive) <a href="https://drafts.csswg.org/css-inline/#text-under-edge">text-under-edge</a> baseline. 
   </dl>
   <div class="example" id="example-705d7900">
    <a class="self-link" href="#example-705d7900"></a> 
    <p>Line boxes almost always shift downward
	(towards the block-end direction)
	when snapping to a <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②③">line grid</a>.
	Here there are three lines
	with 20px line-height
	and line-snap:baseline
	that should snap to a 30px <span id="ref-for-line-grid②④">line grid</span>.
	Each line box shifts down
	so that the baselines align
	with the grid lines.</p>
    <figure style="float:left;">
      <img alt="line positions before snapping" src="images/simple-no-snap.png"> 
     <figcaption> Before line snapping </figcaption>
    </figure>
    <figure style="float:left;">
      <img alt="line positions after snapping" src="images/simple-snapped.png"> 
     <figcaption> After line snapping </figcaption>
    </figure>
    <p style="clear:left;"> In the figures below,
			there are two additional lines
			from h3 elements with line-snap:none.
			These lines do not shift
			to align to the grid,
			but their positions can change
			based on the shifting of lines around them.
			In this example,
			lines 1 2 and 3 shift down
			to snap their baselines to the grid lines,
			and line B has normal line box placement
			just below the line above. </p>
    <figure style="float:left;">
      <img alt="line positions before snapping" src="images/top-no-snap.png"> 
     <figcaption> Before line snapping </figcaption>
    </figure>
    <figure style="float:left;">
      <img alt="line positions after snapping" src="images/top-snapped.png"> 
     <figcaption> After line snapping </figcaption>
    </figure>
   </div>
   <h3 class="heading settled" data-level="3.2" id="box-snap"><span class="secno">3.2. </span><span class="content"> Snapping Block Boxes: the <a class="property" data-link-type="propdesc" href="#propdef-box-snap" id="ref-for-propdef-box-snap②">box-snap</a> property</span><a class="self-link" href="#box-snap"></a></h3>
   <p class="issue" id="issue-2aa6c022"><a class="self-link" href="#issue-2aa6c022"></a> This is a rough draft of trying to solve
	the box-snapping problem.</p>
   <p class="issue" id="issue-9431cf2e"><a class="self-link" href="#issue-9431cf2e"></a> Some optional box values
	(margin-box, border-box)
	could be added to the before and after values
	to allow snapping various box model edges
	to the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②⑤">line grid</a>.</p>
   <p class="issue" id="issue-7e5e0d99"><a class="self-link" href="#issue-7e5e0d99"></a> An auto value could be useful -
	one that defaults to center,
	but snaps to before if it’s the first block in a fragment container,
	and snaps to after if it’s the last block in a fragment container.</p>
   <table class="def propdef" data-link-for-hint="box-snap">
    <tbody>
     <tr>
      <th>Name:
      <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-box-snap">box-snap</dfn>
     <tr class="value">
      <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
      <td class="prod">none <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one③">|</a> block-start <span id="ref-for-comb-one④">|</span> block-end <span id="ref-for-comb-one⑤">|</span> center <span id="ref-for-comb-one⑥">|</span> baseline <span id="ref-for-comb-one⑦">|</span> last-baseline 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
      <td>none 
     <tr>
      <th>Applies to:
      <td>block-level boxes and internal table elements except table cells 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
      <td>yes 
     <tr>
      <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
      <td>N/A 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
      <td>as specified 
     <tr>
      <th>Canonical order:
      <td>per grammar 
     <tr>
      <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
      <td>discrete 
   </table>
   <p>Specifies how the block is snapped to the baseline grid.</p>
   <p>Values have the following meanings:</p>
   <dl>
    <dt><dfn class="css" data-dfn-for="box-snap" data-dfn-type="value" data-export id="valdef-box-snap-none">none<a class="self-link" href="#valdef-box-snap-none"></a></dfn> 
    <dd>The block is not snapped to any grid.
    <dt><dfn class="dfn-paneled css" data-dfn-for="box-snap" data-dfn-type="value" data-export id="valdef-box-snap-block-start">block-start</dfn> 
    <dd>The block-start edge is snapped to the nearest grid line. 
    <dt><dfn class="dfn-paneled css" data-dfn-for="box-snap" data-dfn-type="value" data-export id="valdef-box-snap-block-end">block-end</dfn> 
    <dd>The block-end edge is snapped to the nearest grid line. 
    <dt><dfn class="css" data-dfn-for="box-snap" data-dfn-type="value" data-export id="valdef-box-snap-center">center<a class="self-link" href="#valdef-box-snap-center"></a></dfn> 
    <dd>The block is centered between
		one of the baseline grid’s text-over baselines and a subsequent
		(but not necessarily consecutive) text-under baseline. 
    <dt><dfn class="css" data-dfn-for="box-snap" data-dfn-type="value" data-export id="valdef-box-snap-baseline">baseline<a class="self-link" href="#valdef-box-snap-baseline"></a></dfn> 
    <dd>The first line box’s dominant baseline is snapped to the nearest grid line. 
    <dt><dfn class="css" data-dfn-for="box-snap" data-dfn-type="value" data-export id="valdef-box-snap-last-baseline">last-baseline<a class="self-link" href="#valdef-box-snap-last-baseline"></a></dfn> 
    <dd>The last line box’s dominant baseline is snapped to the nearest grid line. 
   </dl>
   <p>Snapping block boxes always uses the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②⑥">line grid</a> of the box parent
	(a block’s own <span id="ref-for-line-grid②⑦">line grid</span> has no effect on box snapping).
	If the box is an empty block that could be <a href="https://www.w3.org/TR/CSS21/box.html">collapsed through</a>,
	then this property has no effect. <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a></p>
   <p>To snap a block-level element to a grid line,
	take the unsnapped result of layout
	(including margin collapsing, clearance, etc.)
	as the block’s initial position,
	then shift the block downward
	(towards the block-end direction)
	until it snaps to the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②⑧">line grid</a>.</p>
   <p>For the <a class="css" data-link-type="maybe" href="#valdef-box-snap-block-start" id="ref-for-valdef-box-snap-block-start">block-start</a> and <a class="css" data-link-type="maybe" href="#valdef-box-snap-block-end" id="ref-for-valdef-box-snap-block-end">block-end</a> values,
	either the text-over-edge
	or text-under-edge baseline is chosen:
	whichever one is on the matching side
	of the central baseline.
	For example,
	when snapping the block-start edge
	in horizontal writing mode,
	the text-over-edge is chosen.
	In some cases the text-under-edge
	might be used instead for the block-start edge:
	for example,
	when the writing mode of the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid②⑨">line grid</a> doesn’t match that of the affected element,
	or when due to the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-4/#propdef-text-orientation" id="ref-for-propdef-text-orientation">text-orientation</a> settings
	the text-under-edge corresponds to the block-start edge.</p>
   <p>When applied to table row group and table row boxes, <a class="property" data-link-type="propdesc" href="#propdef-box-snap" id="ref-for-propdef-box-snap③">box-snap</a> only affects the before and after edges,
	and only if those edges are not
	at the beginning or end of the table, respectively.
	To snap a before edge on a table row or row group,
	the preceding row’s height is increased.
	To snap an after edge on a table row or row group,
	the affected row’s height is increased.</p>
   <p>When applied to table column group and table column boxes,
	'box-snap’only affects the start and end edges,
	and only if those edges are not
	at the start or end of the table, respectively.
	How the space is redistributed among columns
	to satisfy snapping constraints is not defined, however:</p>
   <ul>
    <li>In an auto-sized table no column may be smaller than its minimum content width. 
    <li>The resulting table must not exceed its original measure if it had a non-auto measure. 
    <li>The adjusted widths must not cause the table to overflow its containing block any more than it would with <a class="css" data-link-type="propdesc" href="#propdef-box-snap" id="ref-for-propdef-box-snap④">box-snap: none</a>. 
   </ul>
   <p>To satisfy these constraints, some column edges may remain unsnapped.</p>
   <div class="issue" id="issue-829f143e">
    <a class="self-link" href="#issue-829f143e"></a> Going forward, we could add a 2-d box-snap
		with more controls
		and to also extend it to handle snapping
		to an explicit layout grid
		(not just the baseline grid).
		Current thoughts are for box-snap
		to break out into longhands;
		the current block-snap property should thus be a subset of its expected future values.
		Below is an outline of the structure.
		(This may, of course, change.) 
<pre>box-snap
  +- block-snap
  |     +- block-snap-edge
  |     |     +- block-start-snap-edge: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" id="ref-for-typedef-shape-box" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a>
  |     |     +- block-end-snap-edge: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" id="ref-for-typedef-shape-box①" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a>
  |     +- block-snap-align: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-align-3/#typedef-content-position" id="ref-for-typedef-content-position" title="Expands to: flex-start | flex-end | end | center | start">&lt;content-position></a>
  |     +- block-snap-grid: text-grid | <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-values-4/#identifier-value" id="ref-for-identifier-value">&lt;custom-ident></a> /* name of grid/gridlines */
  +- inline-snap
        +- inline-snap-edge
        |     +- inline-start-snap-edge: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" id="ref-for-typedef-shape-box②" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a>
        |     +- inline-end-snap-edge: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" id="ref-for-typedef-shape-box③" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a>
        +- inline-snap-align: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-align-3/#typedef-content-position" id="ref-for-typedef-content-position①" title="Expands to: flex-start | flex-end | end | center | start">&lt;content-position></a>
        +- inline-snap-grid: text-grid | <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-values-4/#identifier-value" id="ref-for-identifier-value①">&lt;custom-ident></a> /* name of grid/gridlines */

where <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" id="ref-for-typedef-shape-box④" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a> includes
  margin-box | border-box | half-border-box | padding-box | content-box
and <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-align-3/#typedef-content-position" id="ref-for-typedef-content-position②" title="Expands to: flex-start | flex-end | end | center | start">&lt;content-position></a> includes
  start | end | stretch | first-baseline | last-baseline | center
</pre>
   </div>
   <h2 class="heading settled" data-level="4" id="snap-details"><span class="secno">4. </span><span class="content"> Snapping Details</span><a class="self-link" href="#snap-details"></a></h2>
   <h3 class="heading settled" data-level="4.1" id="alignment-interactions"><span class="secno">4.1. </span><span class="content"> Interacting with other alignments</span><a class="self-link" href="#alignment-interactions"></a></h3>
   <p>An element can have additional block layout constraints
	(such as centering or <a class="property" data-link-type="propdesc" href="#propdef-box-snap" id="ref-for-propdef-box-snap⑤">box-snap</a>)
	that can complicate line snapping.
	In these cases,
	implementations must produce
	the same result as the steps below:</p>
   <ul>
    <li> Line snap as if the layout constraint does not apply 
    <li> Apply the layout constraint to the block 
    <li> Adjust exactly one line box shift
			or space at the beginning or end of the block
			such that all of the snapping lines meet the <a data-link-type="dfn" href="#line-grid" id="ref-for-line-grid③⓪">line grid</a> while maintaining the block layout constraint.
			The single adjustment chosen must be
			the smallest shift needed to achieve the result
			without causing overflow. 
   </ul>
   <div class="example" id="example-463a8867">
    <a class="self-link" href="#example-463a8867"></a> 
    <p>A block containing lines to snap
		might not be top-aligned within its container.
		In the figures below,
		the block containing the elements is centered.
		In a centered situation,
		you have to align baselines
		while maintaining centering.
		This can be done in two shift-and-center steps.</p>
    <p>First, shift the snapping lines
		as if the block was top-aligned
		(as in figure 9 above),
		then remove the shift
		for the very first snapping line.
		After removing the first shift,
		try centering the block.
		This is almost certain
		to throw the baseline alignment off.
		You can see one such result
		in the partial shifting figure below.</p>
    <p>Second, measure the distance
		from the first snapped line’s baseline
		to the grid lines above and below,
		looking for the closest grid line
		to that baseline.</p>
    <p>If the closest grid line
		is in the block-start direction,
		then add space below the last line in the block
		equal to twice that distance.
		Then the block is centered again,
		which will align all of the snapped lines to the grid.</p>
    <figure style="float:left;">
      <img alt="line positions at step 1" src="images/first-center-part-snapped.png"> 
     <figcaption> Partial shifting </figcaption>
    </figure>
    <figure style="float:left;">
      <img alt="line positions after full snapping" src="images/first-center-snapped.png"> 
     <figcaption> Full line snapping </figcaption>
    </figure>
    <p style="clear:left;"> If the closest grid line
			is in the block-end direction,
			then the first snapped line is shifted downward
			by twice that distance.
			Then the block is centered again,
			which will again align all of the snapped lines to the grid. </p>
    <figure style="float:left;">
      <img alt="line positions at step 1" src="images/second-center-part-snapped.png"> 
     <figcaption> Partial shifting </figcaption>
    </figure>
    <figure style="float:left;">
      <img alt="line positions after full snapping" src="images/second-center-snapped.png"> 
     <figcaption> Full line snapping </figcaption>
    </figure>
   </div>
   <div class="example" id="example-cd56247e">
    <a class="self-link" href="#example-cd56247e"></a> 
    <p>An end-aligned block also uses two steps,
		but is simpler than the centered case.</p>
    <p>First, shift the snapping lines
		as if there were no end-alignment
		(as in figure 9 above),
		then end-align the block.</p>
    <p>Second, shift the entire block contents upwards
		until the last snapped line aligns to a grid line.
		In this example, the shift is very minor.</p>
    <figure style="float:left;">
      <img alt="line positions before snapping" src="images/bottom-no-snap.png"> 
     <figcaption> Before snapping </figcaption>
    </figure>
    <figure style="float:left;">
      <img alt="line positions after snapping" src="images/bottom-snapped.png"> 
     <figcaption> After line snapping </figcaption>
    </figure>
   </div>
   <h3 class="heading settled" data-level="4.2" id="leading-adjustments"><span class="secno">4.2. </span><span class="content"> Leading adjustments</span><a class="self-link" href="#leading-adjustments"></a></h3>
   <p>In some cases lines of equal line height
	will not align perfectly to a baseline grid:
	this happens, for example,
	when fonts (of the same size)
	with different baseline tables
	are mixed on a line.
	In these cases,
	removing top half-leading can sometimes be
	the correct thing to do,
	but must be limited
	to the amount of baseline discrepancy
	so as not to trigger in other cases.</p>
   <p class="issue" id="issue-12524285"><a class="self-link" href="#issue-12524285"></a> Details to follow.
	It’s complicated when you have
	more than one font-size or line-height
	in a single line box.</p>
   <h2 class="no-num heading settled" id="acknowledgments"><span class="content">Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2>
   <p>This module was made possible by the advice and contributions of
	Tab Atkins,
	Dave Cramer,
	Dave Hyatt,
	Bem Jones-Bey,
	Håkon Wium Lie,
	Shinyu Murakami,
	Liam Quin,
	and the CSS Working Group members.</p>
   <h2 class="no-num heading settled" id="change-log"><span class="content"> Change Log</span><a class="self-link" href="#change-log"></a></h2>
   <h3 class="no-num heading settled" id="20140916"><span class="content"> Since <a href="https://www.w3.org/TR/2014/WD-css-line-grid-1-20140916/">September 16th 2014</a></span><a class="self-link" href="#20140916"></a></h3>
   <ul>
    <li>Refined ICB/root/@page grid creation
    <li>Added flex and grid container applicability for line-grid
    <li>Added normative text for line-snap examples
    <li>Added @page and root element line grid handling
    <li>Made the dependency on line-height-step explicit
    <li><a class="css" data-link-type="maybe" href="#valdef-line-grid-match-parent" id="ref-for-valdef-line-grid-match-parent②">match-parent</a> creates new line grid for orthoganal flows
   </ul>
   <h3 class="no-num heading settled" id="20140403"><span class="content"> Since <a href="https://www.w3.org/TR/2014/WD-css-line-grid-1-20140403/">April 3rd 2014</a></span><a class="self-link" href="#20140403"></a></h3>
   <ul>
    <li>Added line-snapping examples
    <li>Modified box-snap values
    <li>Removed line-slack
    <li>Removed grid offset
    <li>Removed grid units
    <li>Removed 2d box snapping
    <li>Removed rounding functions
   </ul>
  </main>
  <h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
  <h3 class="heading settled" id="document-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#document-conventions"></a></h3>
  <p>Conformance requirements are expressed with a combination of
	descriptive assertions and RFC 2119 terminology. The key words “MUST”,
	“MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
	“RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
	document are to be interpreted as described in RFC 2119.
	However, for readability, these words do not appear in all uppercase
	letters in this specification. </p>
  <p>All of the text of this specification is normative except sections
	explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
  <p>Examples in this specification are introduced with the words “for example”
	or are set apart from the normative text with <code>class="example"</code>,
	like this: </p>
  <div class="example" id="example-ae2b6bc0">
   <a class="self-link" href="#example-ae2b6bc0"></a> 
   <p>This is an example of an informative example. </p>
  </div>
  <p>Informative notes begin with the word “Note” and are set apart from the
	normative text with <code>class="note"</code>, like this: </p>
  <p class="note" role="note">Note, this is an informative note. </p>
  <p>Advisements are normative sections styled to evoke special attention and are
	set apart from other normative text with <code>&lt;strong class="advisement"></code>, like
	this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p>
  <h3 class="heading settled" id="conform-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#conform-classes"></a></h3>
  <p>Conformance to this specification
	is defined for three conformance classes: </p>
  <dl>
   <dt>style sheet 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#style-sheet">CSS
			style sheet</a>. 
   <dt>renderer 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders
			documents that use them. 
   <dt>authoring tool 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that writes a style sheet. 
  </dl>
  <p>A style sheet is conformant to this specification
	if all of its statements that use syntax defined in this module are valid
	according to the generic CSS grammar and the individual grammars of each
	feature defined in this module. </p>
  <p>A renderer is conformant to this specification
	if, in addition to interpreting the style sheet as defined by the
	appropriate specifications, it supports all the features defined
	by this specification by parsing them correctly
	and rendering the document accordingly. However, the inability of a
	UA to correctly render a document due to limitations of the device
	does not make the UA non-conformant. (For example, a UA is not
	required to render color on a monochrome monitor.) </p>
  <p>An authoring tool is conformant to this specification
	if it writes style sheets that are syntactically correct according to the
	generic CSS grammar and the individual grammars of each feature in
	this module, and meet all other conformance requirements of style sheets
	as described in this module. </p>
  <h3 class="heading settled" id="conform-responsible"><span class="content"> Requirements for Responsible Implementation of CSS</span><a class="self-link" href="#conform-responsible"></a></h3>
  <p>The following sections define several conformance requirements
		for implementing CSS responsibly,
		in a way that promotes interoperability in the present and future. </p>
  <h4 class="heading settled" id="conform-partial"><span class="content"> Partial Implementations</span><a class="self-link" href="#conform-partial"></a></h4>
  <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, <strong>CSS renderers <em>must</em> treat as invalid
		(and <a href="http://www.w3.org/TR/CSS2/conform.html#ignore">ignore as appropriate</a>)
		any at-rules, properties, property values, keywords, and other syntactic constructs
		for which they have no usable level of support</strong>.
		In particular, user agents <em>must not</em> selectively ignore
		unsupported property values and honor supported values in a single multi-value property declaration:
		if any value is considered invalid (as unsupported values must be),
		CSS requires that the entire declaration be ignored. </p>
  <h4 class="heading settled" id="conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#conform-future-proofing"></a></h4>
  <p>To avoid clashes with future stable CSS features,
		the CSSWG recommends <a href="http://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="http://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="http://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p>
  <h4 class="heading settled" id="conform-testing"><span class="content"> Implementations of CR-level Features</span><a class="self-link" href="#conform-testing"></a></h4>
  <p>Once a specification reaches the Candidate Recommendation stage,
		implementers should release an <a data-link-type="dfn" href="http://www.w3.org/TR/CSS/#vendor-prefix">unprefixed</a> implementation
		of any CR-level feature they can demonstrate
		to be correctly implemented according to spec,
		and should avoid exposing a prefixed variant of that feature. </p>
  <p>To establish and maintain the interoperability of CSS across
		implementations, the CSS Working Group requests that non-experimental
		CSS renderers submit an implementation report (and, if necessary, the
		testcases used for that implementation report) to the W3C before
		releasing an unprefixed implementation of any CSS features. Testcases
		submitted to W3C are subject to review and correction by the CSS
		Working Group. </p>
  <p>
   Further information on submitting testcases and implementation reports
		can be found from on the CSS Working Group’s website at <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
		Questions should be directed to the <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list. 
<script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script>
  </p>
  <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
  <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
  <ul class="index">
   <li>
    baseline
    <ul>
     <li><a href="#valdef-box-snap-baseline">value for box-snap</a><span>, in §3.2</span>
     <li><a href="#valdef-line-snap-baseline">value for line-snap</a><span>, in §3.1</span>
    </ul>
   <li><a href="#valdef-box-snap-block-end">block-end</a><span>, in §3.2</span>
   <li><a href="#valdef-box-snap-block-start">block-start</a><span>, in §3.2</span>
   <li><a href="#propdef-box-snap">box-snap</a><span>, in §3.2</span>
   <li><a href="#valdef-box-snap-center">center</a><span>, in §3.2</span>
   <li><a href="#valdef-line-snap-contain">contain</a><span>, in §3.1</span>
   <li><a href="#valdef-line-grid-create">create</a><span>, in §2</span>
   <li><a href="#valdef-box-snap-last-baseline">last-baseline</a><span>, in §3.2</span>
   <li><a href="#propdef-line-grid">line-grid</a><span>, in §2</span>
   <li><a href="#line-grid">Line Grid</a><span>, in §2</span>
   <li><a href="#propdef-line-snap">line-snap</a><span>, in §3.1</span>
   <li><a href="#valdef-line-grid-match-parent">match-parent</a><span>, in §2</span>
   <li>
    none
    <ul>
     <li><a href="#valdef-box-snap-none">value for box-snap</a><span>, in §3.2</span>
     <li><a href="#valdef-line-snap-none">value for line-snap</a><span>, in §3.1</span>
    </ul>
  </ul>
  <aside class="dfn-panel" data-for="term-for-typedef-content-position">
   <a href="https://drafts.csswg.org/css-align-3/#typedef-content-position">https://drafts.csswg.org/css-align-3/#typedef-content-position</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-typedef-content-position">3.2. 
Snapping Block Boxes: the box-snap property</a> <a href="#ref-for-typedef-content-position①">(2)</a> <a href="#ref-for-typedef-content-position②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-block-container">
   <a href="https://drafts.csswg.org/css-display-3/#block-container">https://drafts.csswg.org/css-display-3/#block-container</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-block-container">3.1. 
Snapping Line Boxes: the line-snap property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-line-height-step">
   <a href="https://drafts.csswg.org/css-rhythm-1/#propdef-line-height-step">https://drafts.csswg.org/css-rhythm-1/#propdef-line-height-step</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-line-height-step">2. 
Defining a Line Grid: the line-grid property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-typedef-shape-box">
   <a href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box">https://drafts.csswg.org/css-shapes-1/#typedef-shape-box</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-typedef-shape-box">3.2. 
Snapping Block Boxes: the box-snap property</a> <a href="#ref-for-typedef-shape-box①">(2)</a> <a href="#ref-for-typedef-shape-box②">(3)</a> <a href="#ref-for-typedef-shape-box③">(4)</a> <a href="#ref-for-typedef-shape-box④">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-identifier-value">
   <a href="https://drafts.csswg.org/css-values-4/#identifier-value">https://drafts.csswg.org/css-values-4/#identifier-value</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-identifier-value">3.2. 
Snapping Block Boxes: the box-snap property</a> <a href="#ref-for-identifier-value①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-css-wide-keywords">
   <a href="https://drafts.csswg.org/css-values-4/#css-wide-keywords">https://drafts.csswg.org/css-values-4/#css-wide-keywords</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-css-wide-keywords">1.3. 
Values</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-comb-one">
   <a href="https://drafts.csswg.org/css-values-4/#comb-one">https://drafts.csswg.org/css-values-4/#comb-one</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-comb-one">2. 
Defining a Line Grid: the line-grid property</a>
    <li><a href="#ref-for-comb-one①">3.1. 
Snapping Line Boxes: the line-snap property</a> <a href="#ref-for-comb-one②">(2)</a>
    <li><a href="#ref-for-comb-one③">3.2. 
Snapping Block Boxes: the box-snap property</a> <a href="#ref-for-comb-one④">(2)</a> <a href="#ref-for-comb-one⑤">(3)</a> <a href="#ref-for-comb-one⑥">(4)</a> <a href="#ref-for-comb-one⑦">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-orientation">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#propdef-text-orientation">https://drafts.csswg.org/css-writing-modes-4/#propdef-text-orientation</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-orientation">3.2. 
Snapping Block Boxes: the box-snap property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-writing-mode">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#writing-mode">https://drafts.csswg.org/css-writing-modes-4/#writing-mode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-writing-mode">2. 
Defining a Line Grid: the line-grid property</a> <a href="#ref-for-writing-mode①">(2)</a>
   </ul>
  </aside>
  <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
  <ul class="index">
   <li>
    <a data-link-type="biblio">[css-align-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-typedef-content-position" style="color:initial">&lt;content-position></span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-display-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-block-container" style="color:initial">block container</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-rhythm-1]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-line-height-step" style="color:initial">line-height-step</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-shapes-1]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-typedef-shape-box" style="color:initial">&lt;shape-box></span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-values-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-identifier-value" style="color:initial">&lt;custom-ident></span>
     <li><span class="dfn-paneled" id="term-for-css-wide-keywords" style="color:initial">css-wide keywords</span>
     <li><span class="dfn-paneled" id="term-for-comb-one" style="color:initial">|</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-writing-modes-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-text-orientation" style="color:initial">text-orientation</span>
     <li><span class="dfn-paneled" id="term-for-writing-mode" style="color:initial">writing mode</span>
    </ul>
  </ul>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
  <dl>
   <dt id="biblio-css-align-3">[CSS-ALIGN-3]
   <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-align-3/">CSS Box Alignment Module Level 3</a>. 6 December 2018. WD. URL: <a href="https://www.w3.org/TR/css-align-3/">https://www.w3.org/TR/css-align-3/</a>
   <dt id="biblio-css-display-3">[CSS-DISPLAY-3]
   <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-display-3/">CSS Display Module Level 3</a>. 28 August 2018. CR. URL: <a href="https://www.w3.org/TR/css-display-3/">https://www.w3.org/TR/css-display-3/</a>
   <dt id="biblio-css-rhythm-1">[CSS-RHYTHM-1]
   <dd>Koji Ishii; Elika Etemad. <a href="https://www.w3.org/TR/css-rhythm-1/">CSS Rhythmic Sizing</a>. 2 March 2017. WD. URL: <a href="https://www.w3.org/TR/css-rhythm-1/">https://www.w3.org/TR/css-rhythm-1/</a>
   <dt id="biblio-css-shapes-1">[CSS-SHAPES-1]
   <dd>Vincent Hardy; Rossen Atanassov; Alan Stearns. <a href="https://www.w3.org/TR/css-shapes-1/">CSS Shapes Module Level 1</a>. 20 March 2014. CR. URL: <a href="https://www.w3.org/TR/css-shapes-1/">https://www.w3.org/TR/css-shapes-1/</a>
   <dt id="biblio-css-values-3">[CSS-VALUES-3]
   <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-3/">CSS Values and Units Module Level 3</a>. 31 January 2019. CR. URL: <a href="https://www.w3.org/TR/css-values-3/">https://www.w3.org/TR/css-values-3/</a>
   <dt id="biblio-css-values-4">[CSS-VALUES-4]
   <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-4/">CSS Values and Units Module Level 4</a>. 31 January 2019. WD. URL: <a href="https://www.w3.org/TR/css-values-4/">https://www.w3.org/TR/css-values-4/</a>
   <dt id="biblio-css-writing-modes-4">[CSS-WRITING-MODES-4]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-writing-modes-4/">CSS Writing Modes Level 4</a>. 24 May 2018. CR. URL: <a href="https://www.w3.org/TR/css-writing-modes-4/">https://www.w3.org/TR/css-writing-modes-4/</a>
   <dt id="biblio-css2">[CSS2]
   <dd>Bert Bos; et al. <a href="https://www.w3.org/TR/CSS2/">Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. REC. URL: <a href="https://www.w3.org/TR/CSS2/">https://www.w3.org/TR/CSS2/</a>
   <dt id="biblio-rfc2119">[RFC2119]
   <dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
  </dl>
  <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
  <dl>
   <dt id="biblio-css3line">[CSS3LINE]
   <dd>Dave Cramer; Elika Etemad; Steve Zilles. <a href="https://www.w3.org/TR/css-inline-3/">CSS Inline Layout Module Level 3</a>. 8 August 2018. WD. URL: <a href="https://www.w3.org/TR/css-inline-3/">https://www.w3.org/TR/css-inline-3/</a>
   <dt id="biblio-jlreq">[JLREQ]
   <dd>Yasuhiro Anan; et al. <a href="https://www.w3.org/TR/jlreq/">Requirements for Japanese Text Layout</a>. 3 April 2012. NOTE. URL: <a href="https://www.w3.org/TR/jlreq/">https://www.w3.org/TR/jlreq/</a>
  </dl>
  <h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2>
  <div class="big-element-wrapper">
   <table class="index">
    <thead>
     <tr>
      <th scope="col">Name
      <th scope="col">Value
      <th scope="col">Initial
      <th scope="col">Applies to
      <th scope="col">Inh.
      <th scope="col">%ages
      <th scope="col">Anim­ation type
      <th scope="col">Canonical order
      <th scope="col">Com­puted value
    <tbody>
     <tr>
      <th scope="row"><a class="css" data-link-type="property" href="#propdef-box-snap" id="ref-for-propdef-box-snap⑥">box-snap</a>
      <td>none | block-start | block-end | center | baseline | last-baseline
      <td>none
      <td>block-level boxes and internal table elements except table cells
      <td>yes
      <td>N/A
      <td>discrete
      <td>per grammar
      <td>as specified
     <tr>
      <th scope="row"><a class="css" data-link-type="property" href="#propdef-line-grid" id="ref-for-propdef-line-grid④">line-grid</a>
      <td>match-parent | create
      <td>match-parent
      <td>block, flex and grid containers
      <td>no
      <td>N/A
      <td>discrete
      <td>per grammar
      <td>specified keyword
     <tr>
      <th scope="row"><a class="css" data-link-type="property" href="#propdef-line-snap" id="ref-for-propdef-line-snap③">line-snap</a>
      <td>none | baseline | contain
      <td>none
      <td>block container elements
      <td>yes
      <td>N/A
      <td>discrete
      <td>per grammar
      <td>specified keyword
   </table>
  </div>
  <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
  <div style="counter-reset:issue">
   <div class="issue"> The names of these values is currently up for debate.
	Current suggestions for match-parent
	include match-parent and normal;
	those for create include create and new.<a href="#issue-aa203f7b"> ↵ </a></div>
   <div class="issue"> This is a rough draft of trying to solve
	the box-snapping problem.<a href="#issue-2aa6c022"> ↵ </a></div>
   <div class="issue"> Some optional box values
	(margin-box, border-box)
	could be added to the before and after values
	to allow snapping various box model edges
	to the <a data-link-type="dfn" href="#line-grid">line grid</a>.<a href="#issue-9431cf2e"> ↵ </a></div>
   <div class="issue"> An auto value could be useful -
	one that defaults to center,
	but snaps to before if it’s the first block in a fragment container,
	and snaps to after if it’s the last block in a fragment container.<a href="#issue-7e5e0d99"> ↵ </a></div>
   <div class="issue">
     Going forward, we could add a 2-d box-snap
		with more controls
		and to also extend it to handle snapping
		to an explicit layout grid
		(not just the baseline grid).
		Current thoughts are for box-snap
		to break out into longhands;
		the current block-snap property should thus be a subset of its expected future values.
		Below is an outline of the structure.
		(This may, of course, change.) 
<pre>box-snap
  +- block-snap
  |     +- block-snap-edge
  |     |     +- block-start-snap-edge: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a>
  |     |     +- block-end-snap-edge: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a>
  |     +- block-snap-align: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-align-3/#typedef-content-position" title="Expands to: flex-start | flex-end | end | center | start">&lt;content-position></a>
  |     +- block-snap-grid: text-grid | <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-values-4/#identifier-value">&lt;custom-ident></a> /* name of grid/gridlines */
  +- inline-snap
        +- inline-snap-edge
        |     +- inline-start-snap-edge: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a>
        |     +- inline-end-snap-edge: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a>
        +- inline-snap-align: <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-align-3/#typedef-content-position" title="Expands to: flex-start | flex-end | end | center | start">&lt;content-position></a>
        +- inline-snap-grid: text-grid | <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-values-4/#identifier-value">&lt;custom-ident></a> /* name of grid/gridlines */

where <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-shapes-1/#typedef-shape-box" title="Expands to: border-box | content-box | margin-box | padding-box">&lt;shape-box></a> includes
  margin-box | border-box | half-border-box | padding-box | content-box
and <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-align-3/#typedef-content-position" title="Expands to: flex-start | flex-end | end | center | start">&lt;content-position></a> includes
  start | end | stretch | first-baseline | last-baseline | center
</pre>
     <a href="#issue-829f143e"> ↵ </a>
   </div>
   <div class="issue"> Details to follow.
	It’s complicated when you have
	more than one font-size or line-height
	in a single line box.<a href="#issue-12524285"> ↵ </a></div>
  </div>
  <aside class="dfn-panel" data-for="line-grid">
   <b><a href="#line-grid">#line-grid</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-line-grid">2. 
Defining a Line Grid: the line-grid property</a> <a href="#ref-for-line-grid①">(2)</a> <a href="#ref-for-line-grid②">(3)</a> <a href="#ref-for-line-grid③">(4)</a> <a href="#ref-for-line-grid④">(5)</a> <a href="#ref-for-line-grid⑤">(6)</a> <a href="#ref-for-line-grid⑥">(7)</a> <a href="#ref-for-line-grid⑦">(8)</a> <a href="#ref-for-line-grid⑧">(9)</a> <a href="#ref-for-line-grid⑨">(10)</a> <a href="#ref-for-line-grid①⓪">(11)</a> <a href="#ref-for-line-grid①①">(12)</a> <a href="#ref-for-line-grid①②">(13)</a> <a href="#ref-for-line-grid①③">(14)</a> <a href="#ref-for-line-grid①④">(15)</a> <a href="#ref-for-line-grid①⑤">(16)</a> <a href="#ref-for-line-grid①⑥">(17)</a> <a href="#ref-for-line-grid①⑦">(18)</a> <a href="#ref-for-line-grid①⑧">(19)</a> <a href="#ref-for-line-grid①⑨">(20)</a>
    <li><a href="#ref-for-line-grid②⓪">3. 
Snapping to a Grid</a>
    <li><a href="#ref-for-line-grid②①">3.1. 
Snapping Line Boxes: the line-snap property</a> <a href="#ref-for-line-grid②②">(2)</a> <a href="#ref-for-line-grid②③">(3)</a> <a href="#ref-for-line-grid②④">(4)</a>
    <li><a href="#ref-for-line-grid②⑤">3.2. 
Snapping Block Boxes: the box-snap property</a> <a href="#ref-for-line-grid②⑥">(2)</a> <a href="#ref-for-line-grid②⑦">(3)</a> <a href="#ref-for-line-grid②⑧">(4)</a> <a href="#ref-for-line-grid②⑨">(5)</a>
    <li><a href="#ref-for-line-grid③⓪">4.1. 
Interacting with other alignments</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="propdef-line-grid">
   <b><a href="#propdef-line-grid">#propdef-line-grid</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-line-grid">2. 
Defining a Line Grid: the line-grid property</a> <a href="#ref-for-propdef-line-grid①">(2)</a> <a href="#ref-for-propdef-line-grid②">(3)</a>
    <li><a href="#ref-for-propdef-line-grid③">3.1. 
Snapping Line Boxes: the line-snap property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-line-grid-match-parent">
   <b><a href="#valdef-line-grid-match-parent">#valdef-line-grid-match-parent</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-line-grid-match-parent">2. 
Defining a Line Grid: the line-grid property</a> <a href="#ref-for-valdef-line-grid-match-parent①">(2)</a>
    <li><a href="#ref-for-valdef-line-grid-match-parent②"> Since September 16th 2014</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-line-grid-create">
   <b><a href="#valdef-line-grid-create">#valdef-line-grid-create</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-line-grid-create">2. 
Defining a Line Grid: the line-grid property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="propdef-line-snap">
   <b><a href="#propdef-line-snap">#propdef-line-snap</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-line-snap">2. 
Defining a Line Grid: the line-grid property</a>
    <li><a href="#ref-for-propdef-line-snap①">3. 
Snapping to a Grid</a>
    <li><a href="#ref-for-propdef-line-snap②">3.1. 
Snapping Line Boxes: the line-snap property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="propdef-box-snap">
   <b><a href="#propdef-box-snap">#propdef-box-snap</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-box-snap">2. 
Defining a Line Grid: the line-grid property</a>
    <li><a href="#ref-for-propdef-box-snap①">3. 
Snapping to a Grid</a>
    <li><a href="#ref-for-propdef-box-snap②">3.2. 
Snapping Block Boxes: the box-snap property</a> <a href="#ref-for-propdef-box-snap③">(2)</a> <a href="#ref-for-propdef-box-snap④">(3)</a>
    <li><a href="#ref-for-propdef-box-snap⑤">4.1. 
Interacting with other alignments</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-box-snap-block-start">
   <b><a href="#valdef-box-snap-block-start">#valdef-box-snap-block-start</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-box-snap-block-start">3.2. 
Snapping Block Boxes: the box-snap property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-box-snap-block-end">
   <b><a href="#valdef-box-snap-block-end">#valdef-box-snap-block-end</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-box-snap-block-end">3.2. 
Snapping Block Boxes: the box-snap property</a>
   </ul>
  </aside>
<script>/* script-dfn-panel */

document.body.addEventListener("click", function(e) {
    var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
    // Find the dfn element or panel, if any, that was clicked on.
    var el = e.target;
    var target;
    var hitALink = false;
    while(el.parentElement) {
        if(el.tagName == "A") {
            // Clicking on a link in a <dfn> shouldn't summon the panel
            hitALink = true;
        }
        if(el.classList.contains("dfn-paneled")) {
            target = "dfn";
            break;
        }
        if(el.classList.contains("dfn-panel")) {
            target = "dfn-panel";
            break;
        }
        el = el.parentElement;
    }
    if(target != "dfn-panel") {
        // Turn off any currently "on" or "activated" panels.
        queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
            el.classList.remove("on");
            el.classList.remove("activated");
        });
    }
    if(target == "dfn" && !hitALink) {
        // open the panel
        var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
        if(dfnPanel) {
            dfnPanel.classList.add("on");
            var rect = el.getBoundingClientRect();
            dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
            dfnPanel.style.top = window.scrollY + rect.top + "px";
            var panelRect = dfnPanel.getBoundingClientRect();
            var panelWidth = panelRect.right - panelRect.left;
            if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
                // Reposition, because the panel is overflowing
                dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
            }
        } else {
            console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
        }
    } else if(target == "dfn-panel") {
        // Switch it to "activated" state, which pins it.
        el.classList.add("activated");
        el.style.left = null;
        el.style.top = null;
    }

});
</script>